﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win;

namespace Crystal.CustomControls.Controls
{
    public partial class CrystalTextEditor : TextBox 
    {
        public CrystalTextEditor()
        {
            Layout += CrystalTextEditor_InitializeLayout;
            //InitializeComponent();
        }

        private void CrystalTextEditor_InitializeLayout(object sender, LayoutEventArgs e)
        {
            int[] Values = new int[3];
            if (CommonCustomControls.IsValidString(StyleManager.GetStyle("TextEditorBackColor"), ref Values))
            {
                e.AffectedControl.BackColor = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
            }

            if (CommonCustomControls.IsValidString(StyleManager.GetStyle("TextEditorForeColor"), ref Values))
            {
                e.AffectedControl.ForeColor = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
            }

            if (e.AffectedControl.GetType().Equals(typeof(CrystalTextEditor)))
            {
                //((CrystalTextEditor)e.AffectedControl).DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2010;
                //((CrystalTextEditor)e.AffectedControl).Appearance.BorderColor = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
                //((CrystalTextEditor)e.AffectedControl).Appearance.BorderColor2 = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
                //((CrystalTextEditor)e.AffectedControl).Appearance.BorderColor3DBase = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
            }
        }
    }
}
